package com.attilax.jql;

import java.util.Map;

import javax.servlet.ServletConfig;
import javax.servlet.http.HttpServletRequest;

import com.attilax.db.DBX;
import com.attilax.web.ReqX;
import com.google.inject.Inject;


/**
 *  com.attilax.jql.JqlApiService
 * @author Administrator
 *
 */
public class JqlApiService  {

@Inject
JqlService jsc;

@Inject
DBX dbx;
	 
	public String merge(Object reqx) {
		
		Map req = null;

		if (reqx instanceof HttpServletRequest)
			req = ReqX.toMap((HttpServletRequest) reqx);
		else
			req = (Map) reqx;

		String sql=jsc.saveOrMeger(req);
		System.out.println("--sql:"+sql);
		int i=dbx.executeUpdate(sql);
		
		//String table=(String) req.get("table");
		
		return String.valueOf(i);
	}

	
}


